<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    //为了将普通函数和生成对象的函数区分开,出现了构造函数的概念
    function creatMovie(movieName,type,rate,showTime){
        var movieObj = {};

        movieObj.movieName=movieName;
        movieObj.type=type;
        movieObj.rate=rate;
        movieObj.showTime=showTime;
        movieObj.getNextShowing = function(){
            var current = 11;
            for(var i=0;i<movieObj.showTime.length;i++){
                if(current<parseInt(movieObj.showTime[i])){
                    console.log("下一次的播放时间"+ movieObj.showTime[i]);
                    break;
                }
            }
        }
        return movieObj;
    }

    var movie1 = creatMovie("007","谍战类","9.0",["12:00","15:00","17:00"]);
    var movie2 = creatMovie("指环王","冒险类","9.2",["13:00","16:00","18:00"]);
    console.log(movie1);
    movie1.getNextShowing();
    console.log(movie2);
    movie2.getNextShowing();
</script>
</html>